@model Contoso_University.Models.Instructor

@{
    ViewData["Title"] = "讲师详情";
}

<h1>讲师详情</h1>

<div>
    <h4>讲师信息</h4>
    <hr />
    <dl class="row">
        <dt class="col-sm-2">
            姓
        </dt>
        <dd class="col-sm-10">
            @Html.DisplayFor(model => model.LastName)
        </dd>
        <dt class="col-sm-2">
            名
        </dt>
        <dd class="col-sm-10">
            @Html.DisplayFor(model => model.FirstName)
        </dd>
        <dt class="col-sm-2">
            聘用日期
        </dt>
        <dd class="col-sm-10">
            @Html.DisplayFor(model => model.HireDate)
        </dd>
    </dl>
</div>

@if (Model.CourseAssignments != null && Model.CourseAssignments.Count > 0)
{
    <div>
        <h4>教授的课程</h4>
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>课程编号</th>
                    <th>课程名称</th>
                    <th>学分</th>
                    <th>所属院系</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var assignment in Model.CourseAssignments)
                {
                    <tr>
                        <td>@assignment.Course.CourseID</td>
                        <td>@assignment.Course.Title</td>
                        <td>@assignment.Course.Credits</td>
                        <td>@assignment.Course.Department?.Name</td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
}

<div>
    <a asp-action="Edit" asp-route-id="@Model.ID" class="btn btn-primary">编辑</a>
    <a asp-action="Index" class="btn btn-secondary">返回列表</a>
</div> 